#include <iostream>
#include <map> //multipmap 键对值可以重复

using namespace std;

template <typename T>
void DisplayContent(const T& container) //输出map专用
{
    for(auto myiteraor = container.begin(); myiteraor != container.end(); ++myiteraor)
    {
        cout << myiteraor->second << endl; //默认升序
    }
};

struct myorder
{
    bool operator() (const string& key1, const string& key2) const
    {
        return key1 > key2;
    }
};

typedef map<string, string, myorder>MAP_DESC;
int main(int argc, char const *argv[])
{
    MAP_DESC mymap;
    mymap.insert(make_pair("day", "it is a good day"));
    mymap.insert(make_pair("even", "life is beautiful"));
    // DisplayContent(mymap);
    //查找
    string search;
    while(search != "quit")
    {
        cout << "Please enter a keyword" << endl;
        cin >> search;
        auto searchIterator = mymap.find(search);
        if(searchIterator != mymap.end())
            cout << searchIterator->second << endl;
        else if(search == "quit") break;
        else cout << "no data" << endl;
        cout << "Enter quit to close" << endl;
    }
    return 0;
}
